package test;

import java.security.MessageDigest;
import java.util.Date;
import java.util.List;

import com.rORM.core.Query;
import com.rORM.core.QueryFactory;
import com.rORM.core.TableContext;

import database.LessonName;
import database.Teacher;

/**
 * Created by windyrjc on 2017/5/7.
 */
public class test {
	public static void main(String args[]){
		TableContext.updateJavaPOFile();
		//		int id = 16401;
//		Query q = QueryFactory.createQuery();
////		t = (Teacher)q.queryUniqueRow("select * from teacher where teacherID = ?",Teacher.class,new Object[]{id});
//		List<Teacher> l = q.queryRows("select * from teacher where teacherID = ?", Teacher.class, new Object[]{id});
//		for(Teacher t :l){
//			System.out.println(t.getName());
//		}
//	}
//		Query q = QueryFactory.createQuery();
//		Object o = q.queryValue("select * from student where id = ?", new Object[]{16402},3);
//		System.out.println(o.toString());
//		
		
		Query q = QueryFactory.createQuery();
		List<LessonName> l= q.queryRows("select LessonTable.lessonName from student,score,LessonTable where student.id = score.stuid and score.CourseNum  = LessonTable.lessonID and student.id = ?", LessonName.class, 
				new Object[]{16402});
		System.out.println("");
		for(LessonName name : l){
			System.out.println(name.getLessonName());
		}
}
}
